﻿using System;
using System.Collections.Generic;
using System.Globalization;
using Duo1JHttpServer.Framework.Server;

namespace Duo1JHttpServer.Handler
{
    class GetUserHandler : AbstractHttpHandler
    {
        public override void GetHandler()
        {
            requestModel.OutputWriter.WriteLine("<html><body><h1>getUser</h1>");
            requestModel.OutputWriter.WriteLine($"<p>Current Time: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}</p>");
            requestModel.OutputWriter.WriteLine($"<p>RequestUrl: {requestModel.RequestUrl}</p>");
            foreach (KeyValuePair<string, string> kv in requestModel.RequestParams)
            {
                requestModel.OutputWriter.WriteLine($"<p>{kv.Key}: {kv.Value}</p>");
            }

            requestModel.OutputWriter.WriteLine("</body></http>");
        }

        public override void PostHandler()
        {
        }
    }
}